# NEVER EDIT this file.  It was generated and will be overwritten without
# notice upon regeneration of this application.  You have been warned.
package Contact::Model::number;
use strict; use warnings;

__PACKAGE__->load_components( qw/ InflateColumn::DateTime Core / );
__PACKAGE__->table( 'number' );
__PACKAGE__->add_columns( qw/
    id
    name
    number
    phone_type
/ );
__PACKAGE__->set_primary_key( 'id' );
__PACKAGE__->base_model( 'Contact::Model' );
__PACKAGE__->has_many( birth_days => 'Contact::Model::bday', 'contact' );
__PACKAGE__->has_many( missings => 'Contact::Model::missing' );

sub get_foreign_display_fields {
    return [ qw( name ) ];
}

sub get_foreign_tables {
    return qw(
    );
}

sub foreign_display {
    my $self = shift;

    my $name = $self->name() || '';

    return "$name";
}

sub table_name {
    return 'number';
}

my %select_map_for = (
    phone_type => {
        cell => 'Cell',
        home => 'Home',
    },
);

sub phone_type_display {
    my $self = shift;
    my $phone_type = defined $self->phone_type ? $self->phone_type : '';
    return $select_map_for{ phone_type }{ $phone_type }
           || $phone_type;
}


1;

=head1 NAME

Contact::Model::GEN::number - model for number table (generated part)

=head1 DESCRIPTION

This model inherits from Gantry::Utils::DBIxClass.
It was generated by Bigtop, and IS subject to regeneration.

=head1 METHODS

You may use all normal Gantry::Utils::DBIxClass methods and the
ones listed here:

=over 4

=item get_foreign_display_fields

=item get_foreign_tables

=item foreign_display

=item table_name

=item phone_type_display

=back

=cut
